# 
#  fs/Makefile 
#  
#  last modified at 2007.07.14 22:16 by ChenJie
#

# 目标
TARGET		= init.o
OBJS		= main.o

# 工具及参数定义
CC		= gcc -march=i486
LD		= ld
AR		= ar
CPP		= gcc -E -nostdinc -I../../include
CFLAGS		= -Wall -fno-stack-protector -finline-functions -nostdinc -I../../include 
LDFLAGS		= -r

# CFLAGS 中不能加入-O 的优化参数，否则运行就会出现保护错误，不知道是何原因
# 定义隐式规则
.c.o:
	$(CC) $(CFLAGS)	-c -o $*.o $<
.S.o:
	$(CC) $(CFLAGS) -c -o $*.o $<
.c.s:					
	$(CC) $(CFLAGS) -S -o $*.s $<
.s.o:
	$(CC) $(CFLAGS) -c -o $*.o $<

# All Phony Targets
.PHONY : all clean dep

# Default starting position
all : $(TARGET)

$(TARGET) : $(OBJS) 
	$(LD) $(LDFLAGS) -o $(TARGET) $(OBJS)

clean :
	rm -f $(TARGET) $(OBJS)

dep:
	sed '/\#\#\# Dependencies/q' < Makefile > tmp_make
	(for i in *.c;do $(CPP) -M $$i;done) >> tmp_make
	cp tmp_make Makefile
	rm tmp_make

### Dependencies:
main.o: main.c ../../include/cosstd.h ../../include/cos/ipc.h \
  ../../include/cos/kernel.h
